package Test;

import java.util.HashSet;
import java.util.Scanner;

/**
 * @BelongsProject: LeetCode
 * @BelongsPackage: ClassicalSortingAlgorithm
 * @Author: song
 * @CreateTime: 2022-09-27  02:31
 * @Description: TODO
 * @Version: 1.0
 */

public class IsHuiWenString {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            String str = in.nextLine();
            HashSet<String> set = new HashSet<>();
            for (int i = 0; i < str.length() - 1; i++) {
                for (int j = i + 1; j < str.length(); j++) {
                    String substr = str.substring(i, j + 1);
                    if (set.contains(substr)){
                        continue;
                    }else {
                        set.add(substr);
                        if (isHuiwenStr(substr)) {
                            for (int k = 0; k < substr.length(); k++) {
                                System.out.println(substr.charAt(k));
                            }
                            System.out.println(substr);
                        }
                    }
                }
            }

        }
    }

    public static boolean isHuiwenStr(String substr) {
        StringBuffer sb = new StringBuffer(substr);
        String rs = sb.reverse().toString();
        if (substr.equals(rs)) {
            return true;
        } else {
            return false;
        }
    }
}
